/* eslint-disable @typescript-eslint/no-explicit-any */
import cloudbase from '@cloudbase/js-sdk'
// import config from "@/conf";

const app: any = cloudbase.init({
  env: 'mall-3gj6xvo62f2a6e79',
  region: 'ap-shanghai',
})
const auth: any = app.auth({
  persistence: 'local',
})
async function login() {
  const provider = app.auth().weixinAuthProvider({
    appid: 'wx9bf0d26cd633cbad',
    scope: 'snsapi_base',
  })

  provider.getRedirectResult().then((loginState: boolean) => {
    if (loginState) {
      console.log(loginState)
      // 登录成功，本地已存在登录态
    } else {
      // 未登录，唤起微信登录
      provider.signInWithRedirect()
    }
  })
}
login()
export default app
